3.2.90 \(\int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx\) [190]

3.2.90.1 Optimal result
3.2.90.2 Mathematica [A] (verified)
3.2.90.3 Rubi [A] (verified)
3.2.90.4 Maple [A] (verified)
3.2.90.5 Fricas [B] (verification not implemented)
3.2.90.6 Sympy [F]
3.2.90.7 Maxima [F(-2)]
3.2.90.8 Giac [A] (verification not implemented)
3.2.90.9 Mupad [B] (verification not implemented)

3.2.90.1 Optimal result

Integrand size = 23, antiderivative size = 123 \[ \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx=\frac {a x}{c^2}+\frac {2 \left (b c^3-2 a c^2 d+a d^3\right ) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{c^2 (c-d)^{3/2} (c+d)^{3/2} f}-\frac {d (b c-a d) \tan (e+f x)}{c \left (c^2-d^2\right ) f (c+d \sec (e+f x))} \]

output
a*x/c^2+2*(-2*a*c^2*d+a*d^3+b*c^3)*arctanh((c-d)^(1/2)*tan(1/2*f*x+1/2*e)/ 
(c+d)^(1/2))/c^2/(c-d)^(3/2)/(c+d)^(3/2)/f-d*(-a*d+b*c)*tan(f*x+e)/c/(c^2- 
d^2)/f/(c+d*sec(f*x+e))
 
3.2.90.2 Mathematica [A] (verified)

Time = 1.07 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.26 \[ \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx=\frac {-\frac {2 \left (b c^3+a d \left (-2 c^2+d^2\right )\right ) \text {arctanh}\left (\frac {(-c+d) \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}+\frac {a d \left (c^2-d^2\right ) (e+f x)+a c \left (c^2-d^2\right ) (e+f x) \cos (e+f x)-c d (b c-a d) \sin (e+f x)}{d+c \cos (e+f x)}}{c^2 (c-d) (c+d) f} \]

input
Integrate[(a + b*Sec[e + f*x])/(c + d*Sec[e + f*x])^2,x]
 
output
((-2*(b*c^3 + a*d*(-2*c^2 + d^2))*ArcTanh[((-c + d)*Tan[(e + f*x)/2])/Sqrt 
[c^2 - d^2]])/Sqrt[c^2 - d^2] + (a*d*(c^2 - d^2)*(e + f*x) + a*c*(c^2 - d^ 
2)*(e + f*x)*Cos[e + f*x] - c*d*(b*c - a*d)*Sin[e + f*x])/(d + c*Cos[e + f 
*x]))/(c^2*(c - d)*(c + d)*f)
 
3.2.90.3 Rubi [A] (verified)

Time = 0.72 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.23, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.435, Rules used = {3042, 4411, 25, 3042, 4407, 3042, 4318, 3042, 3138, 221}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a+b \csc \left (e+f x+\frac {\pi }{2}\right )}{\left (c+d \csc \left (e+f x+\frac {\pi }{2}\right )\right )^2}dx\)

\(\Big \downarrow \) 4411

\(\displaystyle -\frac {\int -\frac {a \left (c^2-d^2\right )+c (b c-a d) \sec (e+f x)}{c+d \sec (e+f x)}dx}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\int \frac {a \left (c^2-d^2\right )+c (b c-a d) \sec (e+f x)}{c+d \sec (e+f x)}dx}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {a \left (c^2-d^2\right )+c (b c-a d) \csc \left (e+f x+\frac {\pi }{2}\right )}{c+d \csc \left (e+f x+\frac {\pi }{2}\right )}dx}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 4407

\(\displaystyle \frac {\frac {\left (b c^3-a d \left (2 c^2-d^2\right )\right ) \int \frac {\sec (e+f x)}{c+d \sec (e+f x)}dx}{c}+\frac {a x \left (c^2-d^2\right )}{c}}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\left (b c^3-a d \left (2 c^2-d^2\right )\right ) \int \frac {\csc \left (e+f x+\frac {\pi }{2}\right )}{c+d \csc \left (e+f x+\frac {\pi }{2}\right )}dx}{c}+\frac {a x \left (c^2-d^2\right )}{c}}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 4318

\(\displaystyle \frac {\frac {\left (b c^3-a d \left (2 c^2-d^2\right )\right ) \int \frac {1}{\frac {c \cos (e+f x)}{d}+1}dx}{c d}+\frac {a x \left (c^2-d^2\right )}{c}}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\left (b c^3-a d \left (2 c^2-d^2\right )\right ) \int \frac {1}{\frac {c \sin \left (e+f x+\frac {\pi }{2}\right )}{d}+1}dx}{c d}+\frac {a x \left (c^2-d^2\right )}{c}}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 3138

\(\displaystyle \frac {\frac {2 \left (b c^3-a d \left (2 c^2-d^2\right )\right ) \int \frac {1}{\left (1-\frac {c}{d}\right ) \tan ^2\left (\frac {1}{2} (e+f x)\right )+\frac {c+d}{d}}d\tan \left (\frac {1}{2} (e+f x)\right )}{c d f}+\frac {a x \left (c^2-d^2\right )}{c}}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

\(\Big \downarrow \) 221

\(\displaystyle \frac {\frac {2 \left (b c^3-a d \left (2 c^2-d^2\right )\right ) \text {arctanh}\left (\frac {\sqrt {c-d} \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c+d}}\right )}{c f \sqrt {c-d} \sqrt {c+d}}+\frac {a x \left (c^2-d^2\right )}{c}}{c \left (c^2-d^2\right )}-\frac {d (b c-a d) \tan (e+f x)}{c f \left (c^2-d^2\right ) (c+d \sec (e+f x))}\)

input
Int[(a + b*Sec[e + f*x])/(c + d*Sec[e + f*x])^2,x]
 
output
((a*(c^2 - d^2)*x)/c + (2*(b*c^3 - a*d*(2*c^2 - d^2))*ArcTanh[(Sqrt[c - d] 
*Tan[(e + f*x)/2])/Sqrt[c + d]])/(c*Sqrt[c - d]*Sqrt[c + d]*f))/(c*(c^2 - 
d^2)) - (d*(b*c - a*d)*Tan[e + f*x])/(c*(c^2 - d^2)*f*(c + d*Sec[e + f*x]) 
)
 

3.2.90.3.1 Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 221
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x 
/Rt[-a/b, 2]], x] /; FreeQ[{a, b}, x] && NegQ[a/b]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3138
Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{ 
e = FreeFactors[Tan[(c + d*x)/2], x]}, Simp[2*(e/d)   Subst[Int[1/(a + b + 
(a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] 
 && NeQ[a^2 - b^2, 0]
 

rule 4318
Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbo 
l] :> Simp[1/b   Int[1/(1 + (a/b)*Sin[e + f*x]), x], x] /; FreeQ[{a, b, e, 
f}, x] && NeQ[a^2 - b^2, 0]
 

rule 4407
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
 (a_)), x_Symbol] :> Simp[c*(x/a), x] - Simp[(b*c - a*d)/a   Int[Csc[e + f* 
x]/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c 
- a*d, 0]
 

rule 4411
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(d 
_.) + (c_)), x_Symbol] :> Simp[b*(b*c - a*d)*Cot[e + f*x]*((a + b*Csc[e + f 
*x])^(m + 1)/(a*f*(m + 1)*(a^2 - b^2))), x] + Simp[1/(a*(m + 1)*(a^2 - b^2) 
)   Int[(a + b*Csc[e + f*x])^(m + 1)*Simp[c*(a^2 - b^2)*(m + 1) - (a*(b*c - 
 a*d)*(m + 1))*Csc[e + f*x] + b*(b*c - a*d)*(m + 2)*Csc[e + f*x]^2, x], x], 
 x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && N 
eQ[a^2 - b^2, 0] && IntegerQ[2*m]
 
3.2.90.4 Maple [A] (verified)

Time = 0.63 (sec) , antiderivative size = 168, normalized size of antiderivative = 1.37

method result size
derivativedivides \(\frac {\frac {-\frac {2 d \left (d a -b c \right ) c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c^{2}-d^{2}\right ) \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )}-\frac {2 \left (2 a \,c^{2} d -a \,d^{3}-b \,c^{3}\right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c +d \right ) \left (c -d \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}}{c^{2}}+\frac {2 a \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c^{2}}}{f}\) \(168\)
default \(\frac {\frac {-\frac {2 d \left (d a -b c \right ) c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (c^{2}-d^{2}\right ) \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} c -\tan \left (\frac {f x}{2}+\frac {e}{2}\right )^{2} d -c -d \right )}-\frac {2 \left (2 a \,c^{2} d -a \,d^{3}-b \,c^{3}\right ) \operatorname {arctanh}\left (\frac {\left (c -d \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\sqrt {\left (c +d \right ) \left (c -d \right )}}\right )}{\left (c +d \right ) \left (c -d \right ) \sqrt {\left (c +d \right ) \left (c -d \right )}}}{c^{2}}+\frac {2 a \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{c^{2}}}{f}\) \(168\)
risch \(\frac {a x}{c^{2}}-\frac {2 i d \left (-d a +b c \right ) \left (d \,{\mathrm e}^{i \left (f x +e \right )}+c \right )}{c^{2} \left (c^{2}-d^{2}\right ) f \left ({\mathrm e}^{2 i \left (f x +e \right )} c +2 d \,{\mathrm e}^{i \left (f x +e \right )}+c \right )}+\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i c^{2}+i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{c \sqrt {c^{2}-d^{2}}}\right ) a d}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right ) \left (c -d \right ) f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i c^{2}+i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{c \sqrt {c^{2}-d^{2}}}\right ) a \,d^{3}}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right ) \left (c -d \right ) f \,c^{2}}-\frac {c \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {-i c^{2}+i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{c \sqrt {c^{2}-d^{2}}}\right ) b}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right ) \left (c -d \right ) f}-\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) a d}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right ) \left (c -d \right ) f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) a \,d^{3}}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right ) \left (c -d \right ) f \,c^{2}}+\frac {c \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c^{2}-i d^{2}+\sqrt {c^{2}-d^{2}}\, d}{\sqrt {c^{2}-d^{2}}\, c}\right ) b}{\sqrt {c^{2}-d^{2}}\, \left (c +d \right ) \left (c -d \right ) f}\) \(577\)

input
int((a+b*sec(f*x+e))/(c+d*sec(f*x+e))^2,x,method=_RETURNVERBOSE)
 
output
1/f*(2/c^2*(-d*(a*d-b*c)*c/(c^2-d^2)*tan(1/2*f*x+1/2*e)/(tan(1/2*f*x+1/2*e 
)^2*c-tan(1/2*f*x+1/2*e)^2*d-c-d)-(2*a*c^2*d-a*d^3-b*c^3)/(c+d)/(c-d)/((c+ 
d)*(c-d))^(1/2)*arctanh((c-d)*tan(1/2*f*x+1/2*e)/((c+d)*(c-d))^(1/2)))+2*a 
/c^2*arctan(tan(1/2*f*x+1/2*e)))
 
3.2.90.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 250 vs. \(2 (114) = 228\).

Time = 0.31 (sec) , antiderivative size = 561, normalized size of antiderivative = 4.56 \[ \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx=\left [\frac {2 \, {\left (a c^{5} - 2 \, a c^{3} d^{2} + a c d^{4}\right )} f x \cos \left (f x + e\right ) + 2 \, {\left (a c^{4} d - 2 \, a c^{2} d^{3} + a d^{5}\right )} f x - {\left (b c^{3} d - 2 \, a c^{2} d^{2} + a d^{4} + {\left (b c^{4} - 2 \, a c^{3} d + a c d^{3}\right )} \cos \left (f x + e\right )\right )} \sqrt {c^{2} - d^{2}} \log \left (\frac {2 \, c d \cos \left (f x + e\right ) - {\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, \sqrt {c^{2} - d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right ) - 2 \, {\left (b c^{4} d - a c^{3} d^{2} - b c^{2} d^{3} + a c d^{4}\right )} \sin \left (f x + e\right )}{2 \, {\left ({\left (c^{7} - 2 \, c^{5} d^{2} + c^{3} d^{4}\right )} f \cos \left (f x + e\right ) + {\left (c^{6} d - 2 \, c^{4} d^{3} + c^{2} d^{5}\right )} f\right )}}, \frac {{\left (a c^{5} - 2 \, a c^{3} d^{2} + a c d^{4}\right )} f x \cos \left (f x + e\right ) + {\left (a c^{4} d - 2 \, a c^{2} d^{3} + a d^{5}\right )} f x + {\left (b c^{3} d - 2 \, a c^{2} d^{2} + a d^{4} + {\left (b c^{4} - 2 \, a c^{3} d + a c d^{3}\right )} \cos \left (f x + e\right )\right )} \sqrt {-c^{2} + d^{2}} \arctan \left (-\frac {\sqrt {-c^{2} + d^{2}} {\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right ) - {\left (b c^{4} d - a c^{3} d^{2} - b c^{2} d^{3} + a c d^{4}\right )} \sin \left (f x + e\right )}{{\left (c^{7} - 2 \, c^{5} d^{2} + c^{3} d^{4}\right )} f \cos \left (f x + e\right ) + {\left (c^{6} d - 2 \, c^{4} d^{3} + c^{2} d^{5}\right )} f}\right ] \]

input
integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="fricas")
 
output
[1/2*(2*(a*c^5 - 2*a*c^3*d^2 + a*c*d^4)*f*x*cos(f*x + e) + 2*(a*c^4*d - 2* 
a*c^2*d^3 + a*d^5)*f*x - (b*c^3*d - 2*a*c^2*d^2 + a*d^4 + (b*c^4 - 2*a*c^3 
*d + a*c*d^3)*cos(f*x + e))*sqrt(c^2 - d^2)*log((2*c*d*cos(f*x + e) - (c^2 
 - 2*d^2)*cos(f*x + e)^2 - 2*sqrt(c^2 - d^2)*(d*cos(f*x + e) + c)*sin(f*x 
+ e) + 2*c^2 - d^2)/(c^2*cos(f*x + e)^2 + 2*c*d*cos(f*x + e) + d^2)) - 2*( 
b*c^4*d - a*c^3*d^2 - b*c^2*d^3 + a*c*d^4)*sin(f*x + e))/((c^7 - 2*c^5*d^2 
 + c^3*d^4)*f*cos(f*x + e) + (c^6*d - 2*c^4*d^3 + c^2*d^5)*f), ((a*c^5 - 2 
*a*c^3*d^2 + a*c*d^4)*f*x*cos(f*x + e) + (a*c^4*d - 2*a*c^2*d^3 + a*d^5)*f 
*x + (b*c^3*d - 2*a*c^2*d^2 + a*d^4 + (b*c^4 - 2*a*c^3*d + a*c*d^3)*cos(f* 
x + e))*sqrt(-c^2 + d^2)*arctan(-sqrt(-c^2 + d^2)*(d*cos(f*x + e) + c)/((c 
^2 - d^2)*sin(f*x + e))) - (b*c^4*d - a*c^3*d^2 - b*c^2*d^3 + a*c*d^4)*sin 
(f*x + e))/((c^7 - 2*c^5*d^2 + c^3*d^4)*f*cos(f*x + e) + (c^6*d - 2*c^4*d^ 
3 + c^2*d^5)*f)]
 
3.2.90.6 Sympy [F]

\[ \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx=\int \frac {a + b \sec {\left (e + f x \right )}}{\left (c + d \sec {\left (e + f x \right )}\right )^{2}}\, dx \]

input
integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e))**2,x)
 
output
Integral((a + b*sec(e + f*x))/(c + d*sec(e + f*x))**2, x)
 
3.2.90.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx=\text {Exception raised: ValueError} \]

input
integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="maxima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*c^2-4*d^2>0)', see `assume?` f 
or more de
 
3.2.90.8 Giac [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 201, normalized size of antiderivative = 1.63 \[ \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx=\frac {\frac {2 \, {\left (b c^{3} - 2 \, a c^{2} d + a d^{3}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, c + 2 \, d\right ) + \arctan \left (-\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )}{\sqrt {-c^{2} + d^{2}}}\right )\right )}}{{\left (c^{4} - c^{2} d^{2}\right )} \sqrt {-c^{2} + d^{2}}} + \frac {{\left (f x + e\right )} a}{c^{2}} + \frac {2 \, {\left (b c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - a d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{{\left (c^{3} - c d^{2}\right )} {\left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - c - d\right )}}}{f} \]

input
integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e))^2,x, algorithm="giac")
 
output
(2*(b*c^3 - 2*a*c^2*d + a*d^3)*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(-2*c 
+ 2*d) + arctan(-(c*tan(1/2*f*x + 1/2*e) - d*tan(1/2*f*x + 1/2*e))/sqrt(-c 
^2 + d^2)))/((c^4 - c^2*d^2)*sqrt(-c^2 + d^2)) + (f*x + e)*a/c^2 + 2*(b*c* 
d*tan(1/2*f*x + 1/2*e) - a*d^2*tan(1/2*f*x + 1/2*e))/((c^3 - c*d^2)*(c*tan 
(1/2*f*x + 1/2*e)^2 - d*tan(1/2*f*x + 1/2*e)^2 - c - d)))/f
 
3.2.90.9 Mupad [B] (verification not implemented)

Time = 22.21 (sec) , antiderivative size = 3763, normalized size of antiderivative = 30.59 \[ \int \frac {a+b \sec (e+f x)}{(c+d \sec (e+f x))^2} \, dx=\text {Too large to display} \]

input
int((a + b/cos(e + f*x))/(c + d/cos(e + f*x))^2,x)
 
output
(2*a*atan(((a*((a*((32*(a*c^4*d^5 - b*c^9 - a*c^9 - 3*a*c^6*d^3 + a*c^7*d^ 
2 - b*c^6*d^3 + b*c^7*d^2 + 2*a*c^8*d + b*c^8*d))/(c^5*d + c^6 - c^3*d^3 - 
 c^4*d^2) - (a*tan(e/2 + (f*x)/2)*(2*c^9*d - 2*c^4*d^6 + 2*c^5*d^5 + 4*c^6 
*d^4 - 4*c^7*d^3 - 2*c^8*d^2)*32i)/(c^2*(c^4*d + c^5 - c^2*d^3 - c^3*d^2)) 
)*1i)/c^2 + (32*tan(e/2 + (f*x)/2)*(a^2*c^6 + 2*a^2*d^6 + b^2*c^6 - 2*a^2* 
c*d^5 - 2*a^2*c^5*d - 5*a^2*c^2*d^4 + 4*a^2*c^3*d^3 + 3*a^2*c^4*d^2 - 4*a* 
b*c^5*d + 2*a*b*c^3*d^3))/(c^4*d + c^5 - c^2*d^3 - c^3*d^2)))/c^2 - (a*((a 
*((32*(a*c^4*d^5 - b*c^9 - a*c^9 - 3*a*c^6*d^3 + a*c^7*d^2 - b*c^6*d^3 + b 
*c^7*d^2 + 2*a*c^8*d + b*c^8*d))/(c^5*d + c^6 - c^3*d^3 - c^4*d^2) + (a*ta 
n(e/2 + (f*x)/2)*(2*c^9*d - 2*c^4*d^6 + 2*c^5*d^5 + 4*c^6*d^4 - 4*c^7*d^3 
- 2*c^8*d^2)*32i)/(c^2*(c^4*d + c^5 - c^2*d^3 - c^3*d^2)))*1i)/c^2 - (32*t 
an(e/2 + (f*x)/2)*(a^2*c^6 + 2*a^2*d^6 + b^2*c^6 - 2*a^2*c*d^5 - 2*a^2*c^5 
*d - 5*a^2*c^2*d^4 + 4*a^2*c^3*d^3 + 3*a^2*c^4*d^2 - 4*a*b*c^5*d + 2*a*b*c 
^3*d^3))/(c^4*d + c^5 - c^2*d^3 - c^3*d^2)))/c^2)/((64*(a^3*d^5 + a*b^2*c^ 
5 - a^2*b*c^5 - a^3*c*d^4 + 2*a^3*c^4*d - 3*a^3*c^2*d^3 + 2*a^3*c^3*d^2 + 
a^2*b*c^2*d^3 + a^2*b*c^3*d^2 - 3*a^2*b*c^4*d))/(c^5*d + c^6 - c^3*d^3 - c 
^4*d^2) + (a*((a*((32*(a*c^4*d^5 - b*c^9 - a*c^9 - 3*a*c^6*d^3 + a*c^7*d^2 
 - b*c^6*d^3 + b*c^7*d^2 + 2*a*c^8*d + b*c^8*d))/(c^5*d + c^6 - c^3*d^3 - 
c^4*d^2) - (a*tan(e/2 + (f*x)/2)*(2*c^9*d - 2*c^4*d^6 + 2*c^5*d^5 + 4*c^6* 
d^4 - 4*c^7*d^3 - 2*c^8*d^2)*32i)/(c^2*(c^4*d + c^5 - c^2*d^3 - c^3*d^2...